$(function () {

  //移动端PC端判断
  // if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
  //   window.location = "/pages/mobile/"
  // } else {
  //   // window.location = "/pages"
  // }
  // VUE
  var app2 = new Vue({
    el: '#body',
    data: {
      activeIndex: 0,//banner索引
      bannerList: [
        {
          imageUrl: "/images/banner.png",
          title: "暗黑英雄ce"
        }, {
          imageUrl: "/images/banner.png",
          title: "暗黑英雄1ce"
        }, {
          imageUrl: "/images/banner.png",
          title: "暗黑英雄2"
        }, {
          imageUrl: "/images/banner.png",
          title: "暗黑英雄2"
        },
      ],
      menu: [//顶部导航
        {
          id: "1",
          class: 'indexPa',
          name: "首页",
          href: "../index.html",
          type: true,
        },
        {
          id: "2",
          class: 'introduction',
          name: "介绍",
          href: "../introduce.html",
          type: false,
        },
        {
          id: "3",
          class: 'opus',
          name: "作品",
          href: "../workstip.html",
          type: false,
        },
        {
          id: "4",
          class: 'joinUs',
          name: "加入我们",
          href: "https://www.zhipin.com/gongsir/d22f85933a10bb7203J42NS4Fw~~.html?ka=position-1",
          type: false,
        },
        {
          id: "5",
          class: 'contactUs',
          name: "联系我们",
          href: "../contactus.html",
          type: false,
        }
      ],
      workList: [//光羽动态
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover03.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover01.png",
        },
        {
          imgurl: "/images/cover02.png",
        },
        {
          imgurl: "/images/cover03.png",
        }
      ],
      introducList: [//环境氛围
        {
          id: 0,
          src: "/images/1.png",//缩略图
          bigSrc: "/images/big1.png"//大图查看
        }, {
          id: 1,
          src: "/images/2.png",
          bigSrc: "/images/big3.png"
        }, {
          id: 2,
          src: "/images/3.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 3,
          src: "/images/4.png",
          bigSrc: "/images/big3.png"
        }, {
          id: 4,
          src: "/images/5.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 5,
          src: "/images/6.png",
          bigSrc: "/images/big3.png"
        }, {
          id: 6,
          src: "/images/7.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 7,
          src: "/images/8.png",
          bigSrc: "/images/big3.png"
        },
        {
          id: 8,
          src: "/images/1.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 9,
          src: "/images/2.png",
          bigSrc: "/images/big3.png"
        }, {
          id: 10,
          src: "/images/3.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 11,
          src: "/images/4.png",
          bigSrc: "/images/big3.png"
        }, {
          id: 12,
          src: "/images/5.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 13,
          src: "/images/6.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 14,
          src: "/images/7.png",
          bigSrc: "/images/big1.png"
        }, {
          id: 15,
          src: "/images/8.png",
          bigSrc: "/images/big1.png"
        }
      ],
      opusMenuList: [//作品导航
        {
          id: "0",
          name: "CG动画",
        }, {
          id: "1",
          name: "买量视频",
        }, {
          id: "2",
          name: "2D美术",
        }, {
          id: "3",
          name: "3D美术",
        }, {
          id: "4",
          name: "音乐音效",
        }
      ],
      CGanimationIndex: 0,
      CGanimationList: [//CG动画
        {
          imgUrl: "/images/opus_o01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/banner.png",
          videoLink: "/images/video.mp42",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/3.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/6.png",
          videoLink: "/images/video.mp4",
          name: "创《创世纪》世纪"
        }, {
          imgUrl: "/images/opus_o01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/1.png",
          videoLink: "/images/video.mp4",
          name: "创世纪"
        }, {
          imgUrl: "/images/3.png",
          videoLink: "/images/video.mp4",
          name: "创世纪"
        }, {
          imgUrl: "/images/2.png",
          videoLink: "/images/video.mp4",
          name: "创世纪"
        }, {
          imgUrl: "/images/4.png",
          videoLink: "/images/video.mp4",
          name: "创世纪"
        },
      ],
      buyVideoIndex: 0,
      buyVideoList: [//买量视频
        {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp44",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }, {
          imgUrl: "/images/videoimg_01.png",
          videoLink: "/images/video.mp4",
          name: "《创世纪》"
        }
      ],
      artimgList: [//2D美术
        {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/1.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/1.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/1.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/5.png",
        },
      ],
      threeArtimgList: [//3D美术
        {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/4.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/1.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/5.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/1.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/3.png",
        }, {
          imgUrl: "/images/2.png",
        }, {
          imgUrl: "/images/5.png",
        },
      ],
      audioList: [
        {
          imgUrl: "/images/audio1.png",
          link: "/images/audio.mp3"
        }, {
          imgUrl: "/images/audio2.jpg",
          link: "/images/audio.mp55"
        }, {
          imgUrl: "/images/audio1.png",
          link: "/images/audio.mp3"
        }, {
          imgUrl: "/images/audio2.jpg",
          link: "/images/audio.mp3"
        }, {
          imgUrl: "/images/audio1.png",
          link: "/images/audio.mp3"
        }, {
          imgUrl: "/images/audio2.jpg",
          link: "/images/audio.mp3"
        }
      ],
      layVideolink: "",
      layAudioLink: ""
    },
    mounted: function () {
    
      Vue.nextTick(function () {
        ///瀑布流 
        setTimeout(function(){
          $('#masonry').masonry({
            columnWidth: 10,
            itemSelector: '.item'
          });
        },400)
      })
    },
  })

  //首页banner
  var mySwiper_t = new Swiper('.swiper_two', {
    // autoplay: 5000,//可选选项，自动滑动
    pagination: ".swiper-pagination_two", //分页器
    paginationType: 'fraction',
    onSlideChangeEnd: function (swiper) {
      var title = swiper.slides[swiper.activeIndex].dataset.title
      $(".swiper_two .paginationTwo .title").html(title)
    },
    paginationFractionRender: function (swiper, currentClassName, totalClassName) {
      var title = swiper.slides[0].dataset.title
      return "<div class='paginationTwo'><div class='title'>" + title + "</div><div><span class=" + currentClassName + "></span>/<span class=" + totalClassName + "></span></div></div>"
    }
  })

  // 一屏滚动
  var mySwiperPing = new Swiper('.introductionSwiper', {
    direction: 'vertical',
    mousewheelControl: true,
  })

  // 环境氛围模块
  var mySwiper_th = new Swiper('.introduc_swiper', {
    slidesPerView: 4,
    slidesPerColumn: 2,
    slidesPerColumnFill: 'row',
    pagination: ".introduc-pagination", //分页器
    paginationClickable: true,
    paginationBulletRender: function (swiper, index, className) {
      return '<span class="intli ' + className + '"></span>';
    }
  })

  //作品模块
  var mySwiper_fo = new Swiper('.opusbox', {
    pagination: ".swiper-pagination_opus", //分页器
    paginationType: "bullets",
    direction: 'vertical',//滚动方向
    paginationClickable: true,
    simulateTouch: false,
    mousewheelControl: true,//鼠标滚轮切换
    paginationBulletRender: function (swiper, index, className) {
      var nameText = app2.$data.opusMenuList.filter((items, indexNum) => {
        return indexNum == index
      })[0].name
      return '<span class="opusli ' + className + '"><div class="text">' + nameText + '</div><div class="ball"></div></span>';
    }
  })
  //第一层 CG动画
  var CGanimation = new Swiper('.CGanimationBox_O .CGanimation', {
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    spaceBetween: 10,
    onSlideChangeEnd: function (swiper) {
      app2.$data.CGanimationIndex = swiper.realIndex
      small_CGanimation.slideTo(swiper.realIndex)
    }
  });
  var small_CGanimation = new Swiper('.CGanimationBox_O .small_CGanimation', {
    spaceBetween: 0,
    // centeredSlides: true,
    // slidesPerView: 'auto',
    slidesPerView: 6,
    touchRatio: 0.2,
    slideToClickedSlide: true,
  });
  //缩略图点击事件
  $(".CGanimationBox_O .small_CGanimation .swiper-slide").click(function (e) {
    var index = e.currentTarget.dataset.current
    app2.$data.CGanimationIndex = index
    CGanimation.slideTo(index)
  })
  //大图点击查看视频
  $(".CGanimationBox_O .CGanimation .swiper-slide").click(function (e) {
    var link = e.currentTarget.dataset.link
    app2.$data.layVideolink = link
    layer.open({
      type: 1,
      title: false,
      shadeClose: true,
      content: $("#layVideo"),
      success: function () {
        // $("#layVideo").get(0).play()
      },
      end: function () {
        $("#layVideo").get(0).pause()
        app2.$data.layVideolink = ""
      }
    })
  })
  //
  //第二层 买量视频
  var videoAnimation = new Swiper('.CGanimationBox_T .CGanimation', {
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    spaceBetween: 10,
    onSlideChangeEnd: function (swiper) {
      app2.$data.buyVideoIndex = swiper.realIndex
      small_videoAnimation.slideTo(swiper.realIndex)
    }
  });
  var small_videoAnimation = new Swiper('.CGanimationBox_T .small_CGanimation', {
    spaceBetween: 0,
    // centeredSlides: true,
    // slidesPerView: 'auto',
    slidesPerView: 6,
    touchRatio: 0.2,
    slideToClickedSlide: true,
  });
  //缩略图点击事件
  $(".CGanimationBox_T .small_CGanimation .swiper-slide").click(function (e) {
    var index = e.currentTarget.dataset.current
    app2.$data.buyVideoIndex = index
    videoAnimation.slideTo(index)
  })
  //大图点击查看视频
  $(".CGanimationBox_T .CGanimation .swiper-slide").click(function (e) {
    var link = e.currentTarget.dataset.link
    app2.$data.layVideolink = link
    layer.open({
      type: 1,
      title: false,
      shadeClose: true,
      content: $("#layVideo"),
      success: function () {
        // $("#layVideo").get(0).play()
      },
      end: function () {
        $("#layVideo").get(0).pause()
        app2.$data.layVideolink = ""
      }
    })
  })
  //点击箭头切换swiper模块
  $(".swiperPrev").click(function (e) {
    var type = e.currentTarget.dataset.type
    if (type) {
      mySwiper_fo.slideNext()
    } else {
      mySwiper_fo.slideTo(0)
    }
  })
  //第三层 2d美术
  var tDartBoxul = new Swiper('.tDartBoxul', {
    slidesPerView: 8,
    slidesPerColumn: 4,
    slidesPerColumnFill: 'row',
    paginationClickable: true,
    // pagination: ".introduc-pagination", //分页器
    // paginationClickable: true,
    // paginationBulletRender: function (swiper, index, className) {
    //   return '<span class="intli ' + className + '"></span>';
    // }
  })
  $('.tDartBox .swiper-slide').click(function () {
    layer.photos({
      area: ['1136px', '640px'],
      photos: "#tDartBoxul" //格式见API文档手册页
      , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
    });
  })
  //第四层 3d美术
  var threeDartBoxul = new Swiper('.threeDartBoxul', {
    slidesPerView: 8,
    slidesPerColumn: 4,
    slidesPerColumnFill: 'row',
    paginationClickable: true,
    // pagination: ".introduc-pagination", //分页器
    // paginationClickable: true,
    // paginationBulletRender: function (swiper, index, className) {
    //   return '<span class="intli ' + className + '"></span>';
    // }
  })
  $('.threeDartBox .swiper-slide').click(function () {
    layer.photos({
      area: ['1136px', '640px'],
      photos: "#threeDartBoxul" //格式见API文档手册页
      , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
    });
  })
  //第五层 音乐
  var audio_swiper = new Swiper('.audio_swiper', {
    // autoplay: 5000,//可选选项，自动滑动
    slidesPerView: 4,
    spaceBetween: -120,
    centeredSlides: true,
    loop: false,
    prevButton: '.swiper-button-prev',
    nextButton: '.swiper-button-next'
  })
  //大图点击查看音频
  $(".audioBox .swiper-slide").click(function (e) {
    var link = e.currentTarget.dataset.link
    app2.$data.layAudioLink = link
    layer.open({
      type: 1,
      title: false,
      shadeClose: true,
      content: $("#layAudio"),
      success: function () {
        // $("#layAudio").get(0).play()
      },
      end: function () {
        $("#layAudio").get(0).pause()
        app2.$data.layAudioLink = ""
      }
    })
  })


  //刷新页面 回到最上层
  $("body").animate({ scrollTop: 0 }, "fast");
  // 导航点击
  $(".menu li").click(function (e) {
    e.preventDefault();
    $(this).addClass("on");
    $(this).siblings().removeClass("on");
    // var className = e.currentTarget.classList[0]
    // if (className == "joinUs") {
    //   window.open("https://www.zhipin.com/gongsir/d22f85933a10bb7203J42NS4Fw~~.html?ka=position-1")
    //   return
    // }
    // $(this).addClass("on")
    // $(this).siblings().removeClass("on")
    // // 定向滚动 
    // var scrollTopNum = $('#' + className).offset().top
    // $("body").animate({ scrollTop: scrollTopNum }, "slow");
  })
  //logo 点击返回首页
  $(".logo").click(function (e) {
    // 定向滚动 
    var scrollTopNum = $('#indexPa').offset().top
    $("body").animate({ scrollTop: scrollTopNum }, "slow");
    //首页banner返回到第一张 
    // mySwiper_o.slideTo(0, 0, true);//切换到第一个slide，速度为1秒
    mySwiper_t.slideTo(0, 1000, false);//切换到第一个slide，速度为1秒
  })
  // 箭头向滚动导航
  $(".nextPrev.scrollarrow").click(function (e) {
    var idName = e.currentTarget.dataset.idname
    // 定向滚动 
    var scrollTopNum = $('#' + idName).offset().top
    $("body").animate({ scrollTop: scrollTopNum }, "slow");
    // mySwiper_o.slideNext();
  })
  //介绍向下滚动
  $(".introduction .nextPrev.downarrow").click(function (e) {
    var type = e.currentTarget.dataset.type
    if(type=="introduce"){
      mySwiperPing.slideNext();
    }
  })
  //介绍向上滚动
  $(".introduction .nextPrev.uparrow").click(function (e) { 
    var type = e.currentTarget.dataset.type
    if(type=="introduce"){
      mySwiperPing.slidePrev();
    }
  })
  // 导航点点击滚动
  $(".NavPoint li").click(function (e) {
    var idName = e.currentTarget.dataset.idname
    // 定向滚动 
    var scrollTopNum = $('#' + idName).offset().top
    $("body").animate({ scrollTop: scrollTopNum }, "slow");
    //添加高亮
    $(this).addClass("on")
    $(this).siblings().removeClass("on")
  })

  //animate.css
  $(".animate__animated").hover(function (e) {
    var aniclass = e.currentTarget.dataset.name
    $(this).addClass(aniclass)
  }, function (e) {
    var aniclass = e.currentTarget.dataset.name
    $(this).removeClass(aniclass)
  })





  //页面滚动监听
  $(window).scroll(function (e) {
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    var introductionTop = $('#introduction').offset().top//介绍 
    // 监听首页点导航高亮
    //光羽作品 
    var lightworksTop = $('#lightworks').offset().top
    if (lightworksTop < scrollTop) {
      $(".NavPoint li:nth-child(1)").removeClass("on")
      $(".NavPoint li:nth-child(1)").siblings().addClass("on")
    } else if (0 == scrollTop) {
      $(".NavPoint li:nth-child(1)").addClass("on")
      $(".NavPoint li:nth-child(1)").siblings().removeClass("on")
    }
    // 介绍
    if (introductionTop - 500 < scrollTop) {
      $(".NavPoint").addClass("on")
    } else {
      $(".NavPoint").removeClass("on")
    }

  })
  
    // 滚动效果
    var animateBoxWayPoint = function() { 
          if ($('.animate-box').length > 0) { 
            $('.animate-box').waypoint( function( direction ) {
              if( direction === 'down' && !$(this).hasClass('animated') ) {
                $(this.element).addClass('animate__bounceIn animated');
              }
            } , { offset: '110%' } );
          }
      
    };
    animateBoxWayPoint();


  //底部导航点击事件
  var clipboard = new Clipboard('.btn');
  clipboard.on("success", function () {
    alert("复制成功")
  }) 

 
  //地图
  //创建和初始化地图函数：
  function initMap() {
    createMap();//创建地图
    setMapEvent();//设置地图事件
    addMapControl();//向地图添加控件
  }

  //创建地图函数：
  function createMap() {
    var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
    var point = new BMap.Point(113.379168, 23.12974);//定义一个中心点坐标
    map.centerAndZoom(point, 17);//设定地图的中心点和坐标并将地图显示在地图容器中
    window.map = map;//将map变量存储在全局
  }

  //地图事件设置函数：
  function setMapEvent() {
    map.enableDragging();//启用地图拖拽事件，默认启用(可不写)
    map.enableScrollWheelZoom();//启用地图滚轮放大缩小
    map.enableDoubleClickZoom();//启用鼠标双击放大，默认启用(可不写)
    map.enableKeyboard();//启用键盘上下左右键移动地图
  }

  //地图控件添加函数：
  function addMapControl() {
    //向地图中添加缩放控件
    var ctrl_nav = new BMap.NavigationControl({ anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE });
    map.addControl(ctrl_nav);
    //向地图中添加缩略图控件
    var ctrl_ove = new BMap.OverviewMapControl({ anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1 });
    map.addControl(ctrl_ove);
    //向地图中添加比例尺控件
    var ctrl_sca = new BMap.ScaleControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT });
    map.addControl(ctrl_sca);
  }


  initMap();//创建和初始化地图
 
})



